<template>
    <div>
      <el-card>
        <el-form inline>
          <el-form-item label="流程KEY:" class="mgb-0">
            <el-input v-model="fflowkey"></el-input>
          </el-form-item>
          <el-form-item label="实例KEY:" style="width: 550px;" class="mgb-0">
            <el-input v-model="finstancekey" style="width: 450px;"></el-input>
          </el-form-item>
          <el-form-item class="mgb-0">
            <el-button type="primary" icon="el-icon-search" @click="searchData"></el-button>
            <el-button type="success" icon="el-icon-refresh" @click="clearData"></el-button>
          </el-form-item>
        </el-form>
      </el-card>
      <el-card style="margin-top: 10px">
        <el-table border :data="dataList" v-loading="tableLoading" ref='table'>
          <el-table-column label="流程KEY" width="160" prop="fflowkey" align="center"></el-table-column>
          <el-table-column label="实例KEY" width="450" prop="finstancekey" align="center"></el-table-column>
          <el-table-column label="异常时间" width="160" prop="fdotime" align="center"></el-table-column>
          <el-table-column label="忽略时间" width="160" prop="fignoretime" align="center"></el-table-column>
          <el-table-column label="参数" prop="fparam" align="center"></el-table-column>
          <el-table-column label="原错误信息" prop="ferror" align="center" show-overflow-tooltip></el-table-column>
          <el-table-column label="操作" width="140" align="center">
            <template slot-scope="scope">
              <el-button type="text" @click.stop="openView(scope.row.fid)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          style="float:right; margin: 10px 0;"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page"
          :page-sizes="[15, 50, 100, 200]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          prev-text="上一页"
          next-text="下一页"
          :total="totalRows">
        </el-pagination>
      </el-card>
      <ignoreView v-if="isShowView" :fid="fid" @close="closeDialog"></ignoreView>
    </div>
</template>

<script>
  import IgnoreApi from '@/api/module/IgnoreApi'
  export default {
    name: 'done',
    components:{
      ignoreView: resolve => require(['./components/ignore_view'], resolve),
    },
    data(){
      return{
        fflowkey : '',
        finstancekey : '',
        tableLoading : false,
        dataList : [],
        page: 1,
        pageSize : 15,
        totalRows : 0,
        fid : null,
        isShowView : false,
        api : new IgnoreApi(),
      }
    },
    created(){
      this.getData()
    },
    methods:{
      openView(id){
        this.fid = id
        this.isShowView = true
      },
      getData(){
        this.tableLoading = true
        let data = {
          fflowkey : this.fflowkey,
          finstancekey : this.finstancekey,
          pageSize : this.pageSize,
          page : this.page,
        }
        this.api.queryListPage(data).then(res => {
          this.dataList = res.data.rows
          this.page = res.data.page
          this.pageSize = res.data.pageSize
          this.totalRows = res.data.totalRows
          this.tableLoading = false
        })
      },
      // 当前页码修改时
      handleCurrentChange(page){
        this.page = page
        this.getData()
      },
      // 当前页数修改时
      handleSizeChange(pageSize){
        this.pageSize = pageSize
        this.getData()
      },
      searchData(){
        this.page = 1
        this.getData()
      },
      clearData(){
        this.fflowkey = ''
        this.finstancekey = ''
      },
      //关闭新增编辑弹窗
      closeDialog(){
        this.isShowView = false
        this.fid = null
      },
    },
  }
</script>
<style scoped>
</style>
